<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>栏目管理</title>
    <link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css">
    <script language="javascript" src="${pageContext.request.contextPath}/js/util.js"></script>

    <script>
        function deleteLabel()
        {
            var  str = confirm("是否确定删除上级栏目？");
            if(str == true)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        function getSelectValue(value){
            var id = value;
            var label = document.getElementById("label");
            alert("你将要查询"+label.options[label.selectedIndex].innerText);
            window.location.href="${pageContext.request.contextPath}/newsLabel/findNewsLabelChildren.do?id="+id;
        }
    </script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td height="25" align="center" valign="bottom" class="td06"><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="2%" valign="middle" background="${pageContext.request.contextPath}/images/bg_03.gif">&nbsp;</td>
                    <td width="2%" valign="middle" background="${pageContext.request.contextPath}/images/bg_03.gif"><img src="${pageContext.request.contextPath}/images/main_28.gif" width="9" height="9" align="absmiddle"></td>
                    <td height="30" valign="middle" background="${pageContext.request.contextPath}/images/bg_03.gif"><div align="left"><font color="#FFFFFF">栏目管理</font></div></td>
                </tr>
            </table></td>
        </tr>
    </table>
    <form name="form1" method="post" action="">
        <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="table01">
            <tr>
                <td colspan="2" class="td_02"><SPAN class=td_title>根据栏目名称查询</SPAN></td>
            </tr>
            <tr>
                <td width="14%" class="td_02">栏目名称</td>
                <td width="86%" class="td_02">
                    <select name="select" class="input" style="width:99% " id="label" onchange="getSelectValue(this.value)">
                        <option value="0" selected>--请选择--</option>
                        <c:forEach items="${list}" var="list">
                            <option value="${list.id}" >${list.name}</option>
                        </c:forEach>

                    </select>
                </td>
            </tr>
        </table>
        <br>
        <table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td class="td_page" align="left">
                    <div align="right">
                        <input name="Submit" type="submit" class="buttonface02" value="添加栏目" onClick="javascript:windowOpen('${pageContext.request.contextPath}/newsLabel/addNewsLabelFind.do','','',700,300,'','','')">
                    </div></td>
            </tr>
        </table>
        <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="table01">

            <tr>
                <td colspan="5" align="right" class="td07">
                    <c:if test="${page.pageNum!=1&&page.pageNum==page.totalPages}">
                        <img src="${pageContext.request.contextPath}/images/1.gif" width="4" height="5" align="absmiddle">
                        <a href="${pageContext.request.contextPath}/newsLabel/queryNewsLabel.do?pageNum=1">首页</a>
                        <img src="${pageContext.request.contextPath}/images/2.gif" width="3" height="5" align="absmiddle">　
                        <a href="${pageContext.request.contextPath}/newsLabel/queryNewsLabel.do?pageNum=${(page.pageNum<=1)?page.pageNum:(page.pageNum-1)}">上一页</a>
                        <img src="${pageContext.request.contextPath}/images/2-2.gif" width="3" height="5" align="absmiddle"><a>下一页</a>
                        <img src="${pageContext.request.contextPath}/images/3.gif" width="4" height="5" align="absmiddle"><a>末页</a>
                    </c:if>
                    <c:if test="${page.pageNum!=1&&page.pageNum<page.totalPages}">
                        <img src="${pageContext.request.contextPath}/images/1.gif" width="4" height="5" align="absmiddle">
                        <a href="${pageContext.request.contextPath}/newsLabel/queryNewsLabel.do?pageNum=1">首页</a>
                        <img src="${pageContext.request.contextPath}/images/2.gif" width="3" height="5" align="absmiddle">　
                        <a href="${pageContext.request.contextPath}/newsLabel/queryNewsLabel.do?pageNum=${(page.pageNum<=1)?page.pageNum:(page.pageNum-1)}">上一页</a>
                        <a href="${pageContext.request.contextPath}/newsLabel/queryNewsLabel.do?pageNum=${(page.pageNum>=page.totalPages)?page.pageNum:(page.pageNum+1)}">下一页</a>
                        <img src="${pageContext.request.contextPath}/images/2-2.gif" width="3" height="5" align="absmiddle">
                        <a href="${pageContext.request.contextPath}/newsLabel/queryNewsLabel.do?pageNum=${page.totalPages}">末页</a>
                        <img src="${pageContext.request.contextPath}/images/3.gif" width="4" height="5" align="absmiddle">
                    </c:if>　
                    <c:if test="${page.pageNum==1&&page.pageNum!=page.totalPages}">
                        <img src="${pageContext.request.contextPath}/images/1.gif" width="4" height="5" align="absmiddle"><a>首页</a>
                        <img src="${pageContext.request.contextPath}/images/2.gif" width="3" height="5" align="absmiddle"><a>上一页</a>
                        <a href="${pageContext.request.contextPath}/newsLabel/queryNewsLabel.do?pageNum=${(page.pageNum>=page.totalPages)?page.pageNum:(page.pageNum+1)}">下一页</a>
                        <img src="${pageContext.request.contextPath}/images/2-2.gif" width="3" height="5" align="absmiddle">
                        <a href="${pageContext.request.contextPath}/newsLabel/queryNewsLabel.do?pageNum=${page.totalPages}">末页</a>
                        <img src="${pageContext.request.contextPath}/images/3.gif" width="4" height="5" align="absmiddle">
                    </c:if>　　
                    共${page.pageNum}/${page.totalPages} 页 ${page.totalRows} 条记录
                </td>
            </tr>
            <tr>
                <td width="17%" class="td_top">栏目名称</td>
                <td width="15%" class="td_top">上级栏目名称</td>
                <td width="44%" class="td_top">栏目描述</td>
                <td width="12%" class="td_top">删除</td>
                <td width="12%" class="td_top">修改</td>
            </tr>
            <c:forEach items="${page.datas}" var="data">
                <tr>
                    <td class="td07">${data.name}</td>
                    <td class="td07">${data.parent.name==null?"无":data.parent.name}</td>
                    <td class="td07">${data.content}</td>
                    <td class="td07"><a href="${pageContext.request.contextPath}/newsLabel/deleteNewsLabel.do?id=${data.id}" onClick="deleteLabel()">删除</a></td>
                    <td class="td07"><a href="#" onClick="javascript:windowOpen('${pageContext.request.contextPath}/newsLabel/findUpdateNewsLabel.do?id=${data.id}','','',670,260,'no','yes','100','100')">修改</a>
                    </td>
                </tr>
            </c:forEach>

        </table>
    </form>
</center>
</body>
</html>

